package edu.ustb.efws.base.domain;

import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.builder.ToStringBuilder;

import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.StringJoiner;

/**
 * 用户
 *
 * @author TS Group
 */
public class User {
    @ApiModelProperty(value = "用户编号")
    private Long id;
    @ApiModelProperty(value = "用户名")
    private String username;
    @ApiModelProperty(value = "密码")
    @JsonIgnore
    private String password;
    @ApiModelProperty(value = "联系电话")
    private String tel;
    @ApiModelProperty(value = "姓名")
    private String name;
    @ApiModelProperty(value = "接收报警短信")
    private Boolean sms;
    @ApiModelProperty(value = "是否删除")
    private Boolean delete;
    @ApiModelProperty(value = "是否管理员")
    private Boolean admin;
    @ApiModelProperty(value = "权限角色集合")
    private List<String> roles;
    @ApiModelProperty(value = "订单用户编号")
    private String ddUserId;
    @ApiModelProperty(value = "创建时间")
    private Date createTime;
    @ApiModelProperty(value = "修改时间")
    private Date updateTime;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getTel() {
        return tel;
    }

    public void setTel(String tel) {
        this.tel = tel;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Boolean getSms() {
        return sms;
    }

    public void setSms(Boolean sms) {
        this.sms = sms;
    }

    public Boolean getAdmin() {
        return admin;
    }

    public void setAdmin(Boolean admin) {
        this.admin = admin;
    }

    public Boolean getDelete() {
        return delete;
    }

    public void setDelete(Boolean delete) {
        this.delete = delete;
    }

    public List<String> getRoles() {
        return roles;
    }

    public void setRoles(List<String> roles) {
        this.roles = roles;
    }

    public String getDdUserId() {
        return ddUserId;
    }

    public void setDdUserId(String ddUserId) {
        this.ddUserId = ddUserId;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        User user = (User) o;
        return Objects.equals(id, user.id) && Objects.equals(username, user.username) && Objects.equals(password, user.password) && Objects.equals(tel, user.tel) && Objects.equals(name, user.name) && Objects.equals(sms, user.sms) && Objects.equals(delete, user.delete) && Objects.equals(admin, user.admin) && Objects.equals(roles, user.roles) && Objects.equals(ddUserId, user.ddUserId) && Objects.equals(createTime, user.createTime) && Objects.equals(updateTime, user.updateTime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, username, password, tel, name, sms, delete, admin, roles, ddUserId, createTime, updateTime);
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this)
                .append("id", id)
                .append("username", username)
                .append("password", password)
                .append("tel", tel)
                .append("name", name)
                .append("sms", sms)
                .append("delete", delete)
                .append("admin", admin)
                .append("roles", roles)
                .append("ddUserId", ddUserId)
                .append("createTime", createTime)
                .append("updateTime", updateTime)
                .toString();
    }
}